#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time      :2021/7/2 16:27
# @Author    :cjw
import allure

from app_wework_po.util.log import logger
from app_wework_po.setting import ELEMENT_YML
from app_wework_po.base.base_page import BasePage
from app_wework_po.util.file_operator import YmlOperator


class MainPage(BasePage):
    """主页面"""

    # 添加元素定位数据到locators
    BasePage.locators.update(YmlOperator(ELEMENT_YML['mp']).data)

    def goto_contact_list(self):
        """跳转到通讯录页面"""
        from app_wework_po.page.contact_list_page import ContactListPage

        with allure.step(msg := '点击“通讯录”菜单，跳转到通讯录页面'):
            logger.info(msg)
            self.tap(self.contact_list)
        return ContactListPage(self.driver)

    def goto_workbench(self):
        """跳转到工作台页面"""
        pass
